package com.catmai.pssmanager.service.impl;

import java.sql.SQLException;
import java.util.List;
import java.util.Vector;

import com.catmai.pssmanager.dao.PssFormDao;
import com.catmai.pssmanager.dao.impl.PssFormDaoImpl;
import com.catmai.pssmanager.po.Pssform;
import com.catmai.pssmanager.service.PssformService;

public class PssformServiceImpl implements PssformService{
	
	private PssFormDao pssformDao = new PssFormDaoImpl();

	@Override
	public Vector<Vector> findAll() throws SQLException {
		Vector<Vector> rows = new Vector<>();
		List<Pssform> list = pssformDao.findAll();
		if(!list.isEmpty()) {
			for (Pssform pssform : list) {
				Vector temp = new Vector<>();
				temp.add(pssform.getFormId());
				temp.add(pssform.getGoodsName());
				temp.add(pssform.getChangeNumber());
				temp.add(pssform.getChangeDay());
				temp.add(pssform.getStoreArea());
				temp.add(pssform.getType());
				rows.add(temp);
			}
		}
		
		return rows;
	}

	@Override
	public void saveObject(Pssform pssform) throws SQLException {
		pssformDao.saveObject(pssform);
	}

	@Override
	public void deleteObject(String pssformID) throws SQLException {
		pssformDao.deleteObject(pssformID);
	}

	@Override
	public void updateObject(Pssform pssform) throws SQLException {
		// TODO Auto-generated method stub
		
	}

}
